import request from "@/router/axios";

/**
 * @param current 当前页
 * @param size 每页数据量
 * @returns {AxiosPromise}
 */

//生产BOM 获取产品
export const getBomList = (params) => {
  return request({
    url: "/api/hg-public/prdbom/getBomList",
    method: "get",
    params
  });
};
//生产BOM 根据产品获取投料工序
export const getProcedureList = productId => {
  return request({
    url: "/api/hg-public/prdbom/getProcedureList",
    method: "get",
    params: {
      productId
    }
  });
};
//生产BOM 根据产品获取物料信息
export const getMaterialListByLeaderNo = directLeaderNo => {
  return request({
    url: "/api/hg-public/prdbom/getMaterialListByLeaderNo",
    method: "get",
    params: {
      directLeaderNo
    }
  });
};
//生产BOM 获取所有辅助材料
export const getAMList = directLeaderNo => {
  return request({
    url: "/api/hg-public/prdbom/getAMList",
    method: "get",
    params: {
      directLeaderNo
    }
  });
};
//生产BOM 查询
export const getList = (current, size, params) => {
  return request({
    url: "/api/blade-produce/blade-basic/pdtproducebom/page",
    method: "get",
    params: {
      current,
      size,
      ...params
    }
  });
};

//生产BOM 保存
export const saveOrUpdatePdtProceBom = data => {
  return request({
    url: "/api/blade-produce/blade-basic/pdtproducebom/submit",
    method: "post",
    data: data
  });
};
//生产BOM 删除
export const remove = ids => {
  return request({
    url: "/api/blade-produce/blade-basic/pdtproducebom/remove",
    method: "post",
    params: {
      ids
    }
  });
};

//生产BOM 明细
export const detail = id => {
  return request({
    url: "/api/blade-produce/blade-basic/pdtproducebom/detail",
    method: "get",
    params: {
      id
    }
  });
};
